﻿using System;

namespace Chip8.Core.Processor.Operations
{
	internal class JP : Operation
	{
		public JP(ushort targetAddress)
		{
			TargetAddress = targetAddress;
		}

		public ushort TargetAddress { get; set; }

		public override void Execute(ICPU cpu)
		{
			cpu.PC = TargetAddress;
		}
	}

	internal class JPo : Operation
	{
		public JPo(ushort targetAddress)
		{
			TargetAddress = targetAddress;
		}

		public ushort TargetAddress { get; set; }

		public override void Execute(ICPU cpu)
		{
			var address = cpu.V0 + TargetAddress;
			cpu.PC = (ushort)address;
		}
	}
}
